﻿namespace Arms.Domain.Modules.Geography
{
    using System;
    using System.Collections.Generic;
    using System.Data.Entity.Spatial;
    using System.Linq;

    public class Point : EntityDescribed
    {
        public Point()
        {
            this.Places = new HashSet<Place>();
            this.Cities = new HashSet<City>();
            this.Provinces = new HashSet<Province>();
            this.Countries = new HashSet<Country>();
        }

        public DbGeography Data { get; set; }

        #region Navigation

        public virtual ICollection<Place> Places { get; set; }
        public virtual ICollection<City> Cities { get; set; }
        public virtual ICollection<Province> Provinces { get; set; }
        public virtual ICollection<Country> Countries { get; set; }

        #endregion

        #region Members

        public bool HasPlaces
        {
            get { return this.Places.Any(); }
        }

        public bool HasCities
        {
            get { return this.Cities.Any(); }
        }

        public bool HasProvinces
        {
            get { return this.Provinces.Any(); }
        }

        public bool HasCountries
        {
            get { return this.Countries.Any(); }
        }
        #endregion
    }
}
